package com.cp.elasticsearch;

import com.cp.elasticsearch.mapper.mysql.TBlogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import tk.mybatis.spring.annotation.MapperScan;

@Controller
@SpringBootApplication
@MapperScan("com.cp.elasticsearch.mapper.mysql")
@EnableElasticsearchRepositories("com.cp.elasticsearch.mapper.es")
public class ElasticsearchApplication {

    public static void main(String[] args) {
        SpringApplication.run(ElasticsearchApplication.class, args);
    }

    @Autowired
    TBlogMapper tBlogMapper;

    @RequestMapping("/")
    public String toIndex() {
        System.out.println(tBlogMapper.selectAll().size());
        return "index.html";
    }

}
